package com.bw.ssm.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bw.ssm.dao.GoodsMapper;
import com.bw.ssm.pojo.Goods;
import com.bw.ssm.service.GoodsService;

@Service
public class GoodsServiceImpl implements GoodsService{

	@Autowired
	private GoodsMapper goodsMapper;

	public GoodsMapper getGoodsMapper() {
		return goodsMapper;
	}

	public void setGoodsMapper(GoodsMapper goodsMapper) {
		this.goodsMapper = goodsMapper;
	}
//*************************************************************************************	

	/**
	 * 商品列表查询
	 */
	public List<Goods> findGoodsList() {
		// TODO Auto-generated method stub
		return goodsMapper.findGoodsList();
	}

	/**
	 * 添加商品
	 */
	public void insertGoods(Goods goods) {
		// TODO Auto-generated method stub
		goodsMapper.insertSelective(goods);
	}

	/**
	 * 去修改页面加回显信息
	 */
	public Object toGoodsUpdate(Integer goodsId) {
		// TODO Auto-generated method stub
		return goodsMapper.selectByPrimaryKey(goodsId);
	}

	/**
	 * 修改商品信息
	 */
	public void updateGoods(Goods goods) {
		// TODO Auto-generated method stub
		goodsMapper.updateByPrimaryKeySelective(goods);
	}

	/**
	 * 删除商品
	 */
	public Integer deleteGoods(Integer goodsId) {
		// TODO Auto-generated method stub
		return goodsMapper.deleteByPrimaryKey(goodsId);
	}

//	@Override
//	public List<GoodsType> findGoodsTypeList() {
//		// TODO Auto-generated method stub
//		return goodsMapper.findGoodsTypeList();
//	}

	@Override
	public List<Goods> findGoodsList(int i) {
		// TODO Auto-generated method stub
		return goodsMapper.findGoodsListByPageType(i);
	}
	
	
	
	
	
	
	
}
